<?php
namespace App\Traits;

trait TimeFormat {

	public function getCreatedAtAttribute($value) {
		return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $value)->diffForHumans();
	}

	public function getUpdatedAtAttribute($value) {
		if (is_null($value)) {
			return $value;
		}
		return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $value)->toDateTimeString();
	}
}